from django.db import models


class organization(models.Model):
    "单位表"
    id = models.AutoField(primary_key=True)  # 如果表里面没有写主键，表里面会自动生成一个自增主键字段，叫做id字段，orm要求每个表里面必须要写一个主键
    orgname=models.CharField(verbose_name="单位名",max_length=15)
    org_id=models.CharField(verbose_name="公司简写",unique="unique",max_length=10)
    username = models.CharField(verbose_name="负责人名", max_length=32)
    mobile_phone = models.CharField(verbose_name="手机号", max_length=15,unique="unique")
    password = models.CharField(verbose_name="密码", max_length=32)
    crdate = models.DateTimeField(auto_now_add=True)
    nowdate = models.DateTimeField(auto_now=True)


class trade(models.Model):
    "交易记录表"
    id = models.AutoField(primary_key=True)  # 如果表里面没有写主键，表里面会自动生成一个自增主键字段，叫做id字段，orm要求每个表里面必须要写一个主键
    tradeid = models.CharField(verbose_name="订单ID", max_length=25 ,unique="unique")
    org_id = models.CharField(verbose_name="公司简写", max_length=10)
    money = models.CharField(verbose_name="价格", max_length=32)
    start=models.DateTimeField(verbose_name="套餐开始日期" ,null=True)
    end=models.DateTimeField(verbose_name="套餐结束日期",null=True)
    status_choice = (
        (1, '未支付'),
        (2, '已支付')
    )
    status = models.SmallIntegerField(verbose_name='状态', choices=status_choice)
    type_choice = (
        (1, '套餐1'),
        (2, '套餐2'),
        (3,'套餐3'),
    )
    type= models.SmallIntegerField(verbose_name='状态', choices=type_choice)
    number=models.IntegerField(verbose_name="数量")
    crdate = models.DateTimeField(auto_now_add=True)
    nowdate = models.DateTimeField(auto_now=True)


class guser(models.Model):
    "普通人员表"
    id = models.AutoField(primary_key=True)  # 如果表里面没有写主键，表里面会自动生成一个自增主键字段，叫做id字段，orm要求每个表里面必须要写一个主键
    job_id = models.CharField(verbose_name="工号/学号", max_length=15)
    username=models.CharField(verbose_name="姓名", max_length=10)
    gender_choice = (
        (1, '男'),
        (2, '女')
    )
    gender= models.SmallIntegerField(verbose_name='性别', choices=gender_choice)
    age=models.IntegerField(verbose_name="年龄",null=True)
    mobile_phone = models.CharField(verbose_name="手机号", max_length=15,unique="unique")
    password = models.CharField(verbose_name="密码", max_length=32)
    bumen=models.CharField(verbose_name="部门", max_length=32,null=True)
    org_id = models.CharField(verbose_name="公司简写", max_length=10)
    crdate = models.DateTimeField(auto_now_add=True)
    nowdate = models.DateTimeField(auto_now=True)


class invite(models.Model):
    "邀请码表"
    id = models.AutoField(primary_key=True)  # 如果表里面没有写主键，表里面会自动生成一个自增主键字段，叫做id字段，orm要求每个表里面必须要写一个主键
    invite = models.CharField(verbose_name="邀请码", max_length=15, unique="unique")
    org_id = models.CharField(verbose_name="邀请码所在的公司", max_length=10)
    status_choice = (
        (1, '已启用'),
        (2, '未启用')
    )
    status = models.SmallIntegerField(verbose_name='状态', choices=status_choice)
    number=models.IntegerField(verbose_name="邀请码被使用的次数")
    end = models.DateTimeField(verbose_name="邀请码的到期时间")
    crdate = models.DateTimeField(auto_now_add=True)  # 邀请码的创建时间

class clock(models.Model):#打卡表
    "打卡表"
    id = models.AutoField(primary_key=True)  # 如果表里面没有写主键，表里面会自动生成一个自增主键字段，叫做id字段，orm要求每个表里面必须要写一个主键
    org_id = models.CharField(verbose_name="公司简写", max_length=10) #公司id
    job_id = models.CharField(verbose_name="普通人员id", max_length=15) #工号
    ip=models.CharField(verbose_name="打卡的ip地址", max_length=15) #工号
    crdate = models.DateTimeField(auto_now_add=True)
    nowdate = models.DateTimeField(auto_now=True)
    answer_choice = (
        (1, '是'),
        (2, '否')
    )
    answer1 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer2 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer3 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer4 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer5 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer6 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer7 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer8 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer9 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)
    answer10 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)

    answer11 = models.SmallIntegerField(verbose_name='状态', choices=answer_choice,null=True)


class question(models.Model):
    id = models.AutoField(primary_key=True)  # 如果表里面没有写主键，表里面会自动生成一个自增主键字段，叫做id字段，orm要求每个表里面必须要写一个主键
    org_id = models.CharField(verbose_name="公司简写", max_length=10,unique="unique") # 公司id
    question1 = models.CharField(verbose_name='问题1', max_length=30,null=True)
    question2 = models.CharField(verbose_name='问题2', max_length=30,null=True)
    question3 = models.CharField(verbose_name='问题3', max_length=30,null=True)
    question4 = models.CharField(verbose_name='问题4', max_length=30,null=True)
    question5 = models.CharField(verbose_name='问题5', max_length=30,null=True)
    question6 = models.CharField(verbose_name='问题6', max_length=30,null=True)
    question7 = models.CharField(verbose_name='问题7', max_length=30,null=True)
    question8 = models.CharField(verbose_name='问题8', max_length=30,null=True)
    question9 = models.CharField(verbose_name='问题9', max_length=30,null=True)
    question10 = models.CharField(verbose_name='问题10', max_length=30,null=True)
    question11 = models.CharField(verbose_name='问题11', max_length=30,null=True)
